//
// Created by Administrator on 2023/7/29.
//
#include <string>
#include <iostream>
#include <unordered_map>

using namespace std;

class Solution {
public:
    string decodeMessage(string key, string message) {
        // 构造对照表
        unordered_map<char, char> dict;
        char beginning = 'a';
        for (auto &x: key) {
            if (x != ' ' && !dict.count(x))
                dict[x] = beginning++;
        }
        // 解码
        for(char & i : message){
            if (i != ' '){
                i = dict[i];
            }
        }
        return message;
    }
};

int main() {
    Solution s;
    cout << s.decodeMessage("the quick brown fox jumps over the lazy dog", "vkbs bs t suepuv") << endl;
    cout << s.decodeMessage("eljuxhpwnyrdgtqkviszcfmabo", "zwx hnfx lqantp mnoeius ycgk vcnjrdb") << endl;
}